package cc.xsubj.trading.entity;

import org.newdawn.slick.Image;
import org.newdawn.slick.tiled.TiledMap;

import cc.xsubj.engine.entity.Entity;

public abstract class MapTileObject extends Entity
{

    protected String name;
    protected TiledMap map;

    public MapTileObject(TiledMap map, int groupID, int objectID) {
        // Minus one tile on the Y because of a bug in Tiled.
        super((int)map.getObjectX(groupID, objectID), (int)(map.getObjectY(groupID, objectID)-map.getTileHeight()) );
        name = map.getObjectName(groupID, objectID);
        this.map = map;
    }

    public MapTileObject(float x, float y)
    {
        super(x, y);
    }

    public int getMapX()
    {
    	return (int)(this.x/map.getTileWidth());
    }

    public int getMapY()
    {
    	return (int)(this.y/map.getTileHeight());
    }

    public MapTileObject(float x, float y, Image image)
    {
        super(x, y, image);
    }

}